<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
            var Book = function (id, name, price) {
                //私有属性
                var num = 0
                //私有方法
                function checkId(params) {
                    
                }
                //特权方法,可以访问到类到私有方法
                this.getName = function (params) {}
                this.getId = function name(params) {
                    return num
                }
                //公有属性
                this.id = id
                this.price = price
                this.name = name
                //公有方法
                this.copy = function (params) {}
                //构造器
                function setName(name) {
                    this.name = name
                }
            }
            //静态公有属性
            Book.isChinese = true
            //静态公有方法
            Book.resetTime = function (params) {
                return 'resetTime'
            }
            //通过类的prototype创建
            //两种添加方法，方法一是一一为原型对象属性赋值
            //方法二是将一个对象赋值给原型对象
            Book.prototype = {
                isEnglish :false,
                display : function (params) {
                    return 'display'
                }
            }
            //创建实例对象
            var book = new Book(1,'了不起的比尔盖茨',55)
            console.log(book)
            console.log(book.isEnglish)
            console.log(book.display)
            console.log(book.isChinese)
            console.log(book.resetTime)
            console.log(book.name)
            console.log(book.id)
            console.log(book.price)
    </script>
</body>
</html>